package com.guigu.www.mapper;

import com.guigu.www.pojo.TemplateFood;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author DengHao
 * @since 2021-10-21
 */
public interface TemplateFoodMapper extends BaseMapper<TemplateFood> {
    /*罗露金*/
    @Select("SELECT tf.`temp_food_id`,tf.`temp_food_name`,tf.`temp_food_desc` FROM template_food tf " +
            "INNER JOIN food_inner fi ON tf.`temp_food_id`=fi.`temp_food_id`" +
            " WHERE fi.`food_zong_id`=#{foodZongId}\n")
    List<TemplateFood> queryById(int foodZongId);

    /*陈显科 根据膳食方案的id查询*/
    @Select("SELECT * FROM template_food WHERE temp_food_id   IN(\n" +
            "SELECT temp_food_id FROM food_inner WHERE food_zong_id=#{fid})")
    List<TemplateFood> selectFid(@Param("fid") int fid);
}
